//
//  UILabel+adjusts.m
//  TravelGuideMdd
//
//  Created by 陈曦 on 13-9-10.
//  Copyright (c) 2013年 mafengwo.com. All rights reserved.
//

#import "UILabel+adjusts.h"

@implementation UILabel(adjusts)

- (void)setFontSize:(CGFloat)fontSize
       minFontsSize:(CGFloat)minFontSize
 baselineAdjustment:(UIBaselineAdjustment)aBaselineAdjustment
{
    self.adjustsFontSizeToFitWidth = YES;
    if ([self respondsToSelector:@selector(adjustsLetterSpacingToFitWidth)])
    {
        self.adjustsLetterSpacingToFitWidth = YES;
    }

    self.numberOfLines = 0;
    self.fontSize = fontSize;
    self.baselineAdjustment = aBaselineAdjustment;
    if ([self respondsToSelector:@selector(setMinimumScaleFactor:)])
    {
        self.minimumScaleFactor = minFontSize / fontSize;
    }
    else
    {
        #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        self.minimumFontSize = minFontSize;
        #pragma GCC diagnostic warning "-Wdeprecated-declarations"
    }
    
}

- (void)setFontSize:(CGFloat)fontSize
       minFontsSize:(CGFloat)minFontSize
{
    [self setFontSize:fontSize minFontsSize:minFontSize baselineAdjustment:UIBaselineAdjustmentAlignCenters];
}

@end
